{% block navbar %}
    <div class="navbar navbar-inverse" role="navigation">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle"
                data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="sr-only">切换导航</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="/">幸福的饺子</a>
            </div>
            <div class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    <li><a href="/">首页</a></li>
                </ul>
                <ul class="nav navbar-nav navbar-right">
                    {% if current_user.is_authenticated %}
                        <li><a href="{{ url_for('main.user', username=current_user.username) }}">个人中心</a></li>
                        <li><a href="{{ url_for('auth.logout') }}">退出登录</a></li>
                        <li><a href="{{ url_for('auth.logout') }}">当前用户：{{ current_user.email }}</a></li>
                    {% else %}
                        <li><a href="{{ url_for('auth.register') }}">注册</a></li>
                        <li><a href="{{ url_for('auth.login') }}">登录</a></li>
                        <li><a href="{{ url_for('auth.login') }}">当前用户：游客</a></li>
                    {% endif %}
                    {% if current_user.can(Permission.MODERATE_COMMENTS) %}
                        <li><a href="{{ url_for('main.moderate') }}">Moderate Comments</a></li>
                    {% endif %}
                </ul>
            </div>
        </div>
    </div>
{% endblock navbar %}